package com.fhz.a2102shopjava.bus;

/**
 * 时间:2023/8/18
 *
 * @author Mr.Feng
 * 简述: 构造者模式 实现消息总线数据封装
 */
public class MessageEvent {

    private String message;
    private MessageType type;
    private MessageEvent() {
    }
    public static class Builder{
        private String message;
        private MessageType type;

        public Builder setMessage(String message) {
            this.message = message;
            return this;
        }

        public Builder setType(MessageType type) {
            this.type = type;
            return this;
        }

        public MessageEvent build(){
            MessageEvent messageEvent = new MessageEvent();
            messageEvent.message = this.message;
            messageEvent.type = this.type;
            return messageEvent;
        }
    }

    public String getMessage() {
        return message;
    }

    public MessageType getType() {
        return type;
    }

}
